<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
  <head>
    <base href="<%=basePath%>">
    <title>回答试卷</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<link rel="stylesheet" type="text/css" href="css/main.css" />
	
	<script language="JavaScript">
		var now_time_str;
		var end_time_str;
		var now_time;
		var end_time;
		var nMS;
		var nH;
		var nM;
		var nS;
		function start(){
			now_time_str = document.getElementById("now_time_str").value;
			end_time_str = document.getElementById("end_time_str").value;
			now_time = new Date(Date.parse(now_time_str.replace(/-/g,"/")));
			end_time = new Date(Date.parse(end_time_str.replace(/-/g,"/")));
			nMS = end_time - now_time.getTime();
			if(nMS<0){
				alert("考试已经结束！");
			}else{
				GetRTime();
			}
		}
		function GetRTime(){
			nMS = nMS - 1000;
			nH=Math.floor(nMS/(1000*60*60)) % 24;
			nM=Math.floor(nMS/(1000*60)) % 60;
			nS=Math.floor(nMS/1000) % 60;
			document.getElementById("RemainH").innerHTML=nH;
			document.getElementById("RemainM").innerHTML=nM;
			document.getElementById("RemainS").innerHTML=nS;
			setTimeout("GetRTime()",1000);
		}

		window.onload = start;
	</script>
  </head>
  
  <body>
  	<%@ include file="header.jsp" %>
    
    <DIV id=tips>
		<P class=tips_left>
			您的位置：<A>首页</A> 
			&gt;&gt; <A>考试</A>
			&gt;&gt; <A>回答试卷</A>
		</P>
	</DIV>
		
	<DIV id=container>
		<DIV id=list_left>
			<%@ include file="left_exam.jsp" %>
		</DIV>
		<DIV id=list_right>
			<DIV id=subnav>
				<UL class=subnav_ul1></UL>
				<UL class=subnav_ul2>
					<DIV class=subnav_t>
						<P class=subnav_tl>回答试卷</P>
  						<P class=subnav_tr></P>
  					</DIV>
  					<DIV class=subnav_nr>
  						<form id="answerPaper" name="answerPaper" action="student/checkPaper.html" method="post">
  							<table width="700" align="center" border="0" cellpadding="0" cellspacing="0">
							<tr>
					        	<td class="row_title" colspan="5">
					        		${paper.title}
					        		<input type="hidden" name="paperID" value="${paper.id}" />
					        		<input type="hidden" name="examID" value="${exam.id}" />
					        		<input type="hidden" name="total_score" value="${paper.total_score}" />
					        	</td>
					        	<td></td>
					        </tr>
					        <tr>
					        	<td width="7%"></td>
					        	<td width="13%"></td>
					        	<td class="row_subTitle" width="20%">
					        		考试科目：<a style="color:blue">${subjectName}</a>
					        	</td>
					        	<td class="row_subTitle" width="20%">
					        		岀卷老师：<a style="color:blue">${teacherName}</a>
					        	</td>
					        	<td class="row_subTitle" width="40%">
					        		开始时间：
					        		<a style="color:blue">
					        		<fmt:formatDate value="${start_time}" pattern="yyyy-MM-dd HH:mm:ss" />
					        		</a>
					        	</td>
					        </tr>
					        <tr>
					        	<td></td>
					        	<td></td>
					        	<td class="row_subTitle">
					        		平均难度：<a style="color:blue">${paper.difficulty}</a>
					        	</td>
					        	<td class="row_subTitle">
					        		试卷总分：<a style="color:blue">${paper.total_score}</a>
					        	</td>
					        	<td class="row_subTitle">
					        		结束时间：
					        		<a style="color:blue">
					        		<fmt:formatDate value="${end_time}" pattern="yyyy-MM-dd HH:mm:ss" />
					        		</a>
					        	</td>
					        </tr>
					        <tr>
					        	<td colspan="2"></td>
					        	<td class="row_subTitle" colspan="2">
					        		(<a style="color:red">提醒</a>：当倒计时变为0时，将强制交卷！)
					        	</td>
					        	<td class="row_subTitle">
					        		<input type="hidden" id="now_time_str" name="now_time_str" value="${now_time_str}" />
					        		<input type="hidden" id="end_time_str" name="end_time_str" value="${end_time_str}" />
					        		离考试结束还有：
					        		<strong id="RemainH" style="color:red">XX</strong>小时
					        		<strong id="RemainM" style="color:red">XX</strong>分
					        		<strong id="RemainS" style="color:red">XX</strong>秒
					        	</td>
					        </tr>
					        <tr>
					        	<td class=row_question_type colspan="4">
					        		一、判断题(共${paper.panduan_num}题)：
					        		<input type="hidden" name="panduan_num" value="${paper.panduan_num}" />
					        	</td>
					        </tr>
							<c:forEach items="${panduanList}" var="panduan" varStatus="status">
							<tr>
					        	<td class="row_name" colspan="5">
					        		<c:out value="${status.index + 1}" />.&nbsp;(${panduan.score}分)&nbsp;
					        		${panduan.description}
					        		<input type="hidden" name="panduanID_${status.index}" value="${panduan.id}" />
					        	</td>
							</tr>
							<tr>
								<td></td>
					        	<td class="row_name" colspan="4">
					        		<input type="radio" name="panduan_answer_${status.index}" value="1"/>T
									<input type="radio" name="panduan_answer_${status.index}" value="0"/>F
					        	</td>
							</tr>
							</c:forEach>
							<tr><td><br/></td></tr>
							<tr>
					        	<td class=row_question_type colspan="5">
					        		二、选择题(共${paper.xuanze_num}题)：
					        		<input type="hidden" name="xuanze_num" value="${paper.xuanze_num}" />
					        	</td>
					        </tr>
					        <c:forEach items="${xuanzeList}" var="xuanze" varStatus="status">
							<tr>
					        	<td class="row_name" colspan="5">
					        		<c:out value="${status.index + 1}" />.&nbsp;(${xuanze.score}分)&nbsp;
					        		${xuanze.description}
					        		<input type="hidden" name="xuanzeID_${status.index}" value="${xuanze.id}" />
					        	</td>
							</tr>
							<tr>
								<td></td>
					        	<td class="row_name" colspan="4">
					        		<input type="radio" name="xuanze_answer_${status.index}" value="${xuanze.answer_a}"/>A. ${xuanze.answer_a}
					        		<br/>
									<input type="radio" name="xuanze_answer_${status.index}" value="${xuanze.answer_b}"/>B. ${xuanze.answer_b}
									<br/>
									<input type="radio" name="xuanze_answer_${status.index}" value="${xuanze.answer_c}"/>C. ${xuanze.answer_c}
									<br/>
									<input type="radio" name="xuanze_answer_${status.index}" value="${xuanze.answer_d}"/>D. ${xuanze.answer_d}
					        	</td>
							</tr>
							</c:forEach>
							<tr><td><br/></td></tr>
					        <tr>
					        	<td class=row_question_type colspan="5">
					        		三、填空题(共${paper.tiankong_num}题)：
					        		<input type="hidden" name="tiankong_num" value="${paper.tiankong_num}" />
					        	</td>
					        </tr>
					        <c:forEach items="${tiankongList}" var="tiankong" varStatus="status">
							<tr>
					        	<td class="row_name" colspan="5">
					        		<c:out value="${status.index + 1}" />.&nbsp;(${tiankong.score}分)&nbsp;
					        		${tiankong.description_before}
					        		<input type="text" name="tiankong_answer_${status.index}"/>
									${tiankong.description_after}
									<input type="hidden" name="tiankongID_${status.index}" value="${tiankong.id}" />
					        	</td>
							</tr>
							</c:forEach>
							<tr>
					          	<td colspan="3"></td>
					          	<td class="row_submit">
					          		<input type="submit" name="submit" value=" 交 卷 " onClick="javascript:return confirm('确定交卷？');">
					          	</td>
					        </tr>
						</table>
  						</form>
					</DIV>
				</UL>
				<UL class=subnav_ul3></UL>
			</DIV>
		</DIV>
	</DIV>

    <%@ include file="../footer.jsp" %>
  </body>
</html>
